Two new sound info selectors have been created: siDecompressionParams and siCompressionParams . These selectors are used to pass an atom list to the sound component. Atoms are always in big-endian format. The content of the new audio atom list can consist of many atoms, and always ends with the AudioTerminatorAtom. The first atom in the list should be the AudioFormatAtom, which specifies which sound component is responsible for the atoms contained within the list.
If your application calls the SndGetInfo function with these two selectors, it will return a handle to an atom list. This handle is the responsibility of the caller to be disposed of. The SndSetInfo function requres a pointer to an atom list, and is the responsiblity of the caller to be disposed. For example, to change a decompression sound component from its default of big endian to little endian input, you use the AudioEndianAtom with the "littleEndian" field set to TRUE . Listing 6 shows an example of changing the 32- bit floating point codec to consume little endian format.
Listing 6 Changing the 32 bit floating point codec to consume little endian format
void *atoms;
err = CreateAudioAtomsList(&atoms, k32BitFormat, false);
if (err != noErr) return (err);
err = SndSetInfo(chan, siDecompressionParams, atoms);
Certain sound compression components can show a dialog of options. To determine if the codec supports a dialog, use the SoundComponentGetInfo function with the siOptionsDialog selector. It will return a 16 bit value, with any non-zero value meaning TRUE .
If you use the SoundComponentSetInfo function, the codec will show the dialog and change its settings accordingly, as shown in Listing 7 . For example, the two floating point and the two new 24 and 32 bit integer codecs can show a dialog that allows the user to specify big or little endian. You can also change a compressor's setting using the siCompressionParams selector.
Listing 7 Using the SoundComponentSetInfo function to show the dialog of options
short hasDialog;
err = SoundComponentGetInfo(compressor, nil, siOptionsDialog, &hasDialog);
if (err != noErr) return (err);
if (hasDialog)
{
err = SoundComponentSetInfo(compressor, nil, siOptionsDialog, nil);
if (err != noErr) return (err);
}
| Previous | Chapter Contents | Chapter Top | Next |